package cn.com.guage.dtm.huawei;

import java.util.Scanner;

public class 判断字符串子序列 {
    public static void main(String[] args) {
        method1();
    }

    private static void method1() {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNext()) { // 注意 while 处理多个 case
            String s = in.next();
            String t = in.next();
            int res = process(s, t);
            System.out.println(res);
        }
    }

    private static void method2(){
        Scanner sc = new Scanner(System.in);
        String target = "";
        String source = "";
        target = sc.nextLine();
        source = sc.nextLine();
        System.out.println(source.contains(target));
    }

    private static int process(String s, String t) {
        if (s.length() < t.length()) {
            String tmp = t;
            t = s;
            s = tmp;
        }
        int sEnd = s.length()-1;
        int tEnd = t.length()-1;
        while (sEnd >= 0 ) {
            char s1 = s.charAt(sEnd);
            char t1 = t.charAt(tEnd);
            while (sEnd >= 0 && tEnd >= 0 && s1 == t1) {
                sEnd--;
                tEnd--;
            }
            if (tEnd < 0) return 1;
            tEnd = t.length()-1; //  此处开始找下一个相同的点进行比较
            sEnd--;
        }
        return 0;
    }
}

